import redis.clients.jedis.Jedis;

public class JedisTest {
    public static void main(String[] args) {
        //1.连接redis服务器
        Jedis jedis = new Jedis("192.168.254.168",6379);
        //2.如果有密码
        //jedis.auth(password)
        int i = 0;
        try{
            var begin = System.currentTimeMillis();
            while(true){
                var end = System.currentTimeMillis();
                if(end - begin >= 1000)
                    break;
                jedis.set("avatar:test:" + i, "value_" + i);
                i++;
            }
        } finally {
            //关闭连接
            jedis.close();
        }
        System.out.println("在1s时间范围内redis的读写次数:" + i);
    }
}
